-
-
Notifications
You must be signed in to change notification settings - Fork 362
fix(Table): AutoScrollLastSelectedRowToView support ClickSelect mode #7019
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-Authored-By: braia123 <[email protected]>
Co-Authored-By: water1983 <[email protected]>
Reviewer's guide (collapsed on small PRs)Reviewer's GuideRefactor auto-scroll behavior by introducing a helper that identifies the last selected row via its active state, enabling support for ClickSelect mode. Class diagram for updated Table auto-scroll logicclassDiagram
class Table {
}
class getSelectedRow_element_ {
+element: HTMLElement
+returns: HTMLElement | undefined
}
Table --> getSelectedRow_element_ : uses
Flow diagram for auto-scroll to last selected row in ClickSelect modeflowchart TD
A["User selects a row (ClickSelect mode)"] --> B["Row gets 'active' class"]
B --> C["scroll() function called"]
C --> D["getSelectedRow(element) finds last 'tr.active'"]
D --> E["Scrolls row into view"]
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes the AutoScrollLastSelectedRowToView feature in the Table component to support ClickSelect mode by changing the row selection detection logic from checkbox-based to row-based selection.
Key Changes:
- Updated the scroll function to detect selected rows using
tr.activeclass instead of checkbox states - Version bumps for both beta and release candidate versions
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/BootstrapBlazor/Components/Table/Table.razor.js | Refactored row selection detection to support ClickSelect mode by introducing getSelectedRow helper function |
| src/BootstrapBlazor/BootstrapBlazor.csproj | Version bumps from 9.11.5-beta08 to beta09 and 10.0.0-rc.2.1.7 to rc.2.1.8 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey there - I've reviewed your changes - here's some feedback:
- Consider falling back to the original
.form-check.is-checkedselector if notr.activeis found to maintain compatibility with non-ClickSelect modes. - Since
getSelectedRowis only used once, you might inline it intoscrollto simplify the code and avoid an extra function. - Using
pop()will always pick the last active row; double-check whether selecting the first or last active row aligns with expected multi-select behavior.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Consider falling back to the original `.form-check.is-checked` selector if no `tr.active` is found to maintain compatibility with non-ClickSelect modes.
- Since `getSelectedRow` is only used once, you might inline it into `scroll` to simplify the code and avoid an extra function.
- Using `pop()` will always pick the last active row; double-check whether selecting the first or last active row aligns with expected multi-select behavior.
## Individual Comments
### Comment 1
<location> `src/BootstrapBlazor/Components/Table/Table.razor.js:232-235` </location>
<code_context>
}
}
+const getSelectedRow = element => {
+ const rows = [...element.querySelectorAll('tr.active')];
+ return rows.pop()
+}
+
</code_context>
<issue_to_address>
**suggestion:** Using 'pop()' on the array of active rows will select the last active row, which may not always be the intended behavior.
If only one row should be active, use 'find' or access the first element for clarity. If multiple can be active, specify which row should be selected.
```suggestion
const getSelectedRow = element => {
const rows = [...element.querySelectorAll('tr.active')];
return rows.length > 0 ? rows[0] : null;
}
```
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7019 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 743 743
Lines 32451 32451
Branches 4495 4495
=========================================
Hits 32451 32451
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Link issues
fixes #7018
Summary By Copilot
Regression?
Risk
Verification
Packaging changes reviewed?
☑️ Self Check before Merge
Summary by Sourcery
Fix auto-scrolling of the last selected row in ClickSelect mode and refactor scroll logic
Bug Fixes:
Enhancements: